/**
 * $File: TT_Logic_Playing.h
 * $Synopsis: Logic Stuff Header
 * $Author: Ted Yin (ymfoi)
 * $Version: alpha 1.0
 * $Date: Sat Nov 27 23:00:24 2010 CST
 */

#ifndef TT_LOGIC_PLAYING_H
#define TT_LOGIC_PLAYING_H

#include "TT_Logic.h"
#include "../Render/TT_Graphics_DrawObj.h"
#include "../Render/TT_Graphics_Camera.h"

#include <cmath>

#define STATE_PAUSE 0
#define STATE_MENU 1
#define STATE_STARTING 2
#define STATE_PLAYING 3

#define EYE_ROTATE_EPS 1e-1

namespace TT_Logic {

	class Playing_State : public Game_State {

		TT_Core::Pos P1,P2;
		TT_Core::Arena *Round;

		int P1_Cx,P1_Cy,P1_Cz,P1_ID;
		int P2_Cx,P2_Cy,P2_Cz,P2_ID;

		const TT_Core::PlayerNode *P1_Ptr;
		const TT_Core::PlayerNode *P2_Ptr;

		int Arena_Row,Arena_Col;

		struct EyeDeg {

			float Deg,Des,d;
			void Change(int ActType);
			static void IdleMoveReal(EyeDeg *Real);

		} P1_EyeDir,P2_EyeDir;

		int Round_Anima_ID,P1_EyeDir_Anima_ID;

		void NewRound();

		public:

		Playing_State();

		void Draw();
		void Idle(double DetTime);
		void Init();
		void Exit();

		void Keyboard_Trigger(UCHAR key,int x,int y);
		void Special_Keyboard_Trigger(int key,int x,int y);
		void Mouse_Trigger();
	};
}


#endif //TT_LOGIC_PLAYING_H



